package command;

/**
 * @Author: linKe
 * @Date: 2022/1/14 23:14
 * @FileName: MacroOnCommand
 * @version: 1.0
 * @Description: 宏打开命令
 */
public class MacroOnCommand implements Command{
    private Command[] commands;

    public MacroOnCommand(Command[] commands) {
        this.commands = commands;
    }

    @Override
    public void execute() {
        // 执行所有实现command接口的实例对象方法
        for(Command command : commands) {
            command.execute();
        }
    }

    @Override
    public void undo() {
        // 执行所有实现command接口的实例对象方法
        for(Command command : commands) {
            command.undo();
        }
    }
}
